package com.csust.automaticteach.model.enums;

import cn.hutool.core.util.ObjUtil;
import lombok.Getter;

@Getter
public enum MessageTypeEnum {
    SYSTEM("系统", "系统");
    //后续可扩展其他消息类型
//    TEACHER("教师", "teacher"),
//    ADMIN("管理员", "admin");


    private final String text;
    private final String value;

    MessageTypeEnum(String text, String value) {
        this.text = text;
        this.value = value;
    }

    /**
     * 根据 value  获取 userRole
     *
     * @param value value
     * @return userRole
     */
    public static MessageTypeEnum getEnumByValue(String value) {
        if (ObjUtil.isEmpty(value)) {
            return null;
        }
        for (MessageTypeEnum role : values()) {
            if (role.value.equals(value)) {
                return role;
            }
        }
        return null;
    }
}
